package com.example.project.controller.merchant;

import com.example.project.common.Result;
import com.example.project.dto.request.ShopRequest;
import com.example.project.service.ShopService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("/api/merchant/shop")
@RequiredArgsConstructor
public class MerchantShopController {

    private final ShopService shopService;

    @GetMapping
    public Result<?> getShopInfo(@RequestAttribute Long userId) {
        return shopService.getShopInfo(userId);
    }

    @PostMapping
    public Result<?> createShop(@RequestBody @Valid ShopRequest request, 
                               @RequestAttribute Long userId) {
        return shopService.createShop(request, userId);
    }

    @PutMapping
    public Result<?> updateShop(@RequestBody @Valid ShopRequest request, 
                               @RequestAttribute Long userId) {
        return shopService.updateShop(request, userId);
    }

    @PutMapping("/status")
    public Result<?> updateShopStatus(@RequestParam Integer status, 
                                    @RequestAttribute Long userId) {
        return shopService.updateShopStatus(userId, status);
    }
} 